Skip to content

feat: add ToolCall.from_map/1 and to_map/1 for normalized tool call handling#396

Merged
mikehostetler merged 1 commit intomainfrom
feat/tool-call-from-map
Feb 1, 2026
Merged

feat: add ToolCall.from_map/1 and to_map/1 for normalized tool call handling#396
mikehostetler merged 1 commit intomainfrom
feat/tool-call-from-map

Conversation

@mikehostetler
Copy link
Contributor

Adds two helper functions to ToolCall module:

  • to_map/1: Convert ToolCall struct to flat map with decoded arguments
  • from_map/1: Normalize map or ToolCall to standard %{id, name, arguments} format

These are used by jido_ai for consistent tool call processing across providers.

Changes

  • Added ToolCall.to_map/1 function
  • Added ToolCall.from_map/1 function
  • Added tests for both functions

…andling

Adds two helper functions to ToolCall module:
- to_map/1: Convert ToolCall struct to flat map with decoded arguments
- from_map/1: Normalize map or ToolCall to standard %{id, name, arguments} format

These are used by jido_ai for consistent tool call processing across providers.

Amp-Thread-ID: https://ampcode.com/threads/T-019c1692-7ccb-732c-b146-db36ab4ec368
Co-authored-by: Amp <amp@ampcode.com>
@mikehostetler mikehostetler merged commit 7c9d70c into main Feb 1, 2026
6 checks passed
@mikehostetler mikehostetler deleted the feat/tool-call-from-map branch February 1, 2026 00:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant